var containsDuplicate = function (nums) {
  var set = new Set(nums)
  if (set.size !== nums.length) {
    return true
  }
  return false
};
let arr1 = [1, 2, 3, 1]
console.log(containsDuplicate(arr1))